home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / examples / bup < prev    next >
Encoding:
Text File  |  1994-02-08  |  2.0 KB  |  80 lines

  1. #!/usr/local/bin/icmake -qi
  2.  
  3. #define ETCDIR        "/usr/local/etc"
  4.  
  5. #define VER        "1.00"
  6.  
  7. list
  8.     volumes;                // backup volumes
  9.  
  10. void init ()                // definition of backup volumes
  11. {                    // always: dirs, descrip, etc
  12.     volumes += 
  13.         (list) "dummy_1" +        // bup 0: dummy
  14.                     (list) "dummy_2" +
  15.         (list) "/" +            // bup 1: whole disk
  16.                     (list) "whole UNIX disk" +
  17.         (list) "/home/karel/dos" +    // bup 2: DOS disk
  18.                     (list) "DOS partition" +
  19.         (list) "/usr/local/bin /conf" +    //bup 3: local stuff
  20.                     (list) "local UNIX stuff" +
  21.     (list) "/home/karel" +        // bup 4: user Karel
  22.                 (list) "user Karel, except for DOS"
  23.     ;
  24. }
  25.  
  26. void usage ()
  27. {
  28.     int
  29.         i;
  30.         
  31.     printf ("\n"
  32.             "ICCE Backup Runner  V", VER, "\n"
  33.             "Copyright (c) ICCE 1993. All rights reserved.\n"
  34.             "\n"
  35.             "Bup by Karel Kubat.\n"
  36.             "\n"
  37.             "Usage: bup volume-number\n"
  38.             "Where:\n"
  39.             "       volume-number: number of volume to show/run\n"
  40.             "\n"
  41.             "Volumes may be:\n");
  42.     for (i = 2; i < sizeof (volumes); i += 2)
  43.         printf (i / 2, ":    ", element (i + 1, volumes), " (", 
  44.             element (i, volumes), ")\n");
  45.     printf ("\n"
  46.             "The actual backup is perfomed by the Icmake program `backup'.\n"
  47.             "If the file ", ETCDIR, "/bup.<volume-number>.exclude exists,\n"
  48.             "then the files listed in this file are excluded from the backup.\n"
  49.             "\n");
  50.             
  51.     exit (1);
  52. }    
  53.  
  54. void main (int argc, list argv)        // start of program
  55. {
  56.     string
  57.         excludefile,
  58.         volstring;
  59.     int
  60.         volnum,
  61.         showsize;
  62.  
  63.     init ();
  64.         
  65.     volstring = element (1, argv);
  66.     volnum = (int) volstring * 2;
  67.     if (volnum < 2 || volnum >= sizeof (volumes))
  68.         usage ();
  69.         
  70.     excludefile = ETCDIR + "/" + "bup." + volstring + ".exclude";
  71.     
  72.     if (exists (excludefile))    
  73.         exec ("backup", "-v", "store", element (volnum, volumes),
  74.               "--exclude-from", excludefile);
  75.     else
  76.         exec ("backup", "-v", "store", element (volnum, volumes));
  77.         
  78.     exit (0);
  79. }
  80.